package com.uphone.kingmall.adapter;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.china.zhuoyue.R;
import com.uphone.kingmall.bean.LiuYanReplyBean;
import com.uphone.kingmall.utils.CommonUtil;

/**
 * <pre>
 *     author : radish
 *     e-mail : 15703379121@163.com
 *     time   : 2019/5/6
 *     desc   :
 * </pre>
 */
public class LiuYanReplyAdapter extends BaseQuickAdapter<LiuYanReplyBean.DataBean, BaseViewHolder> {
    private final int type;

    public LiuYanReplyAdapter(int type) {
        super(R.layout.kingmall_item_liuyan_reply);
        this.type = type;
    }

    @Override
    protected void convert(BaseViewHolder helper, LiuYanReplyBean.DataBean item) {
        if (type == 0) {
            helper.setText(R.id.tv_time1, CommonUtil.getStr(item.getCreateTime()))
                    .setText(R.id.tv_type, "留言")
                    .setText(R.id.tv_time2, item.getFeedStatus() == 0 ? "" : CommonUtil.getStr(item.getReplyTime()))
                    .setText(R.id.tv_content1, CommonUtil.getStr(item.getContent()))
                    .setGone(R.id.tv_shop_name, false)
                    .setText(R.id.tv_content2, item.getFeedStatus() == 0 ? "暂无回复" : CommonUtil.getStr(item.getReply()));
        } else {
            helper.setText(R.id.tv_time1, CommonUtil.getStr(item.getCreateTime()))
                    .setText(R.id.tv_type, "投诉")
                    .setText(R.id.tv_time2, item.getRepStatus() == 0 ? "" : CommonUtil.getStr(item.getReplyTime()))
                    .setText(R.id.tv_content1, CommonUtil.getStr(item.getRepContent()))
                    .setText(R.id.tv_shop_name, CommonUtil.getStr(item.getItemName()))
                    .setGone(R.id.tv_shop_name, true)
                    .setText(R.id.tv_content2, item.getRepStatus() == 0 ? "暂无回复" : CommonUtil.getStr(item.getReply()));

        }
    }
}
